//
//  ZJNavTool.m
//  zijinlian
//
//  Created by lzy on 2017/3/7.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "ZJNavTool.h"

@implementation ZJNavTool


+(void)rightItemOnNavigationItem:(UIViewController *)controller target:(id)target action:(SEL)action andType:(RightItemType)type
{
    UIButton *finishBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [finishBtn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
     if (type == item_register)
    {
        [finishBtn setTitle:MyString(@"注册") forState:UIControlStateNormal];
        finishBtn.titleLabel.font = FontAndStyle14;
        [finishBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        //文字    30*30
        [finishBtn setFrame:CGRectMake(0, 0, 30, 30)];
    }
    else if (type == item_message)
    {
        [finishBtn setBackgroundImage:[UIImage imageNamed:@"icon_message_nor"] forState:UIControlStateNormal];
        //[finishBtn setBackgroundImage:[UIImage imageNamed:@"actionbar_quit_pressed"] forState:UIControlStateHighlighted];
         //图片    20*20
        [finishBtn setFrame:CGRectMake(0, 0, 20, 20)];
    }else if(type==item_save){
        [finishBtn setTitle:MyString(@"保存") forState:UIControlStateNormal];
        finishBtn.titleLabel.font = FontAndStyle14;
        [finishBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        //文字    30*30
        [finishBtn setFrame:CGRectMake(0, 0, 30, 30)];
        
    }else if(type==item_manage){
        [finishBtn setTitle:MyString(@"管理") forState:UIControlStateNormal];
        finishBtn.titleLabel.font = FontAndStyle14;
        [finishBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        //文字    30*30
        [finishBtn setFrame:CGRectMake(0, 0, 30, 30)];
        
    }else if(type==item_edit){
        [finishBtn setTitle:MyString(@"编辑") forState:UIControlStateNormal];
        finishBtn.titleLabel.font = FontAndStyle14;
        [finishBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        //文字    30*30
        [finishBtn setFrame:CGRectMake(0, 0, 30, 30)];
    }
    controller.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithCustomView:finishBtn];
}

@end
